var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    data:{},
    lunbo:{},
    scrollX:0,
    scrollX1:0,
    oID:"2,3",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this;
    wx.request({
      url: "https://bag.idianwei.com/index.php/Api/Api/lunbo",
      data:{},
      success:function(red){
        // console.log(red.data.resultObj);
        that.setData({
          lunbo : red.data.resultObj
        });
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    wx.request({
      url: 'https://bag.idianwei.com/index.php/Api/Api/repackList',
      data: {
        goodsType: this.data.oID,
        page:1,
        row:10,
      },
      success: res => {
        console.log(res);
        this.setData({
          data: res.data.resultObj,
        })
      }
    })
  },
  detail: function (e) {
    var id = e.currentTarget.dataset.id;
    var good = e.currentTarget.dataset.text;
    // console.log(good);
    // console.log(id);
    wx.navigateTo({
      url: '../../index/detail/detail?order=' + this.data.oID +'&ID='+good,
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
  sta:function(own){
    // console.log(own);
  },
  mov:function(own){
    // console.log(own);
    this.setData({
      scrollX: own.target.offsetTop
    })
  },
  end: function (own) {
    // console.log(own.target.offsetTop);
    this.setData({
      scrollX1: own.target.offsetTop
    })
  },
  search: res => {
    wx.navigateTo({
      url: '/pages/index/search/search',
    })
  }
})